//
//  InputCommentView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/4.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "InputCommentView.h"

@implementation InputCommentView

- (instancetype)initWithInSuperView:(UIView *)aSuperView
{
    if (self = [super initWithInSuperView:aSuperView]) {
        CGFloat viX = 0;
        CGFloat viH = kHeightProportion_In_iPhoneTriploid(50);
        CGFloat viY = KScreenHeight - kHeightProportion_In_iPhoneTriploid(122) - viH;
        CGFloat viW = KScreenWidth;
        self.frame = CGRectMake(viX, viY, viW, viH);
        self.backgroundColor = [UIColor whiteColor];
        
        CGFloat vi2X = 0;
        CGFloat vi2Y = 0;
        CGFloat vi2W = viW;
        CGFloat vi2H = kHeightProportion_In_iPhoneTriploid(1);
        GLGWView *view2 = [[GLGWView alloc] initWithFrame:CGRectMake(vi2X, vi2Y, vi2W, vi2H) inSuperView:self];
        view2.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
        
        CGFloat vi3X = kWidthProportion_In_iPhoneTriploid(15);
        CGFloat vi3Y = kHeightProportion_In_iPhoneTriploid(5);
        CGFloat vi3W = viW - 2 * vi3X;
        CGFloat vi3H = viH - 2 * vi3Y;
        GLGWView *view3 = [[GLGWView alloc] initWithFrame:CGRectMake(vi3X, vi3Y, vi3W, vi3H) inSuperView:self];
        view3.layer.cornerRadius = vi3H / 2;
        view3.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        
        CGFloat btnW = kWidthProportion_In_iPhoneTriploid(50);
        CGFloat btnX = view3.width - btnW;
        CGFloat btnY = 0;
        CGFloat btnH = vi3H;
        GLGWButton *btn = [[GLGWButton alloc] initWithFrame:CGRectMake(btnX, btnY, btnW, btnH) inSuperView:view3];
        [btn setImage:[UIImage imageNamed:@"goods_share"] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(expressionAction:) forControlEvents:UIControlEventTouchUpInside];
        
        CGFloat textX = kWidthProportion_In_iPhoneTriploid(15);
        CGFloat textY = kHeightProportion_In_iPhoneTriploid(4);
        CGFloat textW = vi3W - textX - btnW;
        CGFloat textH = vi3H - textY * 2;
        GLGWTextView *textVieW = [[GLGWTextView alloc] initWithFrame:CGRectMake(textX, textY, textW, textH) fontType:SYSTEMFONT(14) colorType:kColor_Rule_Black inSuperView:view3];
        textVieW.placeholder = @"回复评论";
        textVieW.maxInputLength = 360;
        textVieW.placeholderAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#999999"]};
        textVieW.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        _botTextView = textVieW;

    }
    return self;
}

- (void)expressionAction:(GLGWButton *)sender
{
    if (self.BlockExpression) {
        self.BlockExpression(sender);
    }
}

@end
